import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout'
import {main} from './module'

/* Router Modules */
export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/Login.vue'),
    hidden: true,
    meta: { title: '登录' },
  },
  {
    path: '/:cathchAll(.*)',
    name: '404',
    component: () => import('@/views/error-page/404.vue'),
    hidden: true,
    meta: { title: '404'},
  },
  ...main,

]

const router = createRouter({
  history: createWebHashHistory(),
  scrollBehavior: () => ({ top: 0 }),
  routes: constantRoutes
})

export default router
